<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core">

<h:head>
	<title><ui:insert name="title">Default title</ui:insert></title>
</h:head>

<ui:composition template="/WEB-INF/template/template.xhtml">

	<ui:define name="content">

		<br />
		<div class="middle">
			<h:messages class="myError" showSummary="true" showDetail="false"></h:messages>
			<h:panelGrid styleClass="panelGridError"
				rendered="#{editProfileBean.isError}">
				<h:outputText rendered="#{editProfileBean.isError}"
					value="#{editProfileBean.errorMsg}"></h:outputText>
			</h:panelGrid>

			<h3>
				<h:outputText value="#{msg.BU_editProfile_editP_header}" />
			</h3>

			<br />
			<h:outputText rendered="#{editProfileBean.confMsg != ''}"
				value="#{editProfileBean.confMsg}" />

			<h:form>
				<div class="middle">
					<h:panelGrid class="panelGrid" id="tabel" border="0" columns="2">
						<h:outputText value="#{msg.BU_editProfile_editP_name}"></h:outputText>
						<h:inputText value="#{editProfileBean.userDTO.name}"
							required="true"
							requiredMessage="#{msg.BU_editProfile_requiredMessage1}"
							validatorMessage="#{msg.BU_editProfile_validatorMessage1}">
							<f:validateRegex pattern="^([A-Z]{1}[a-z]+[ ]?[-]?)+$" />
						</h:inputText>

						<h:outputText value="#{msg.BU_editProfile_editP_email}"></h:outputText>
						<h:inputText id="email" value="#{editProfileBean.userDTO.email}"
							required="true"
							requiredMessage="#{msg.BU_editProfile_requiredMessage2}">
							<f:validator validatorId="validators.EmailValidator" />
						</h:inputText>

						<h:outputText value="#{msg.BU_editProfile_editP_usertype}"></h:outputText>
						<h:inputText readonly="true" value="#{editProfileBean.usertype}"></h:inputText>


						<h:outputText rendered="#{editProfileBean.userDTO.idDomain!=0}"
							value="#{msg.BU_editProfile_editP_domain}" />
						<h:inputText readonly="true"
							rendered="#{editProfileBean.userDTO.idDomain!=0}"
							value="#{editProfileBean.userDomain}" />

					</h:panelGrid>

				</div>


				<br />

				<div class="middle">
					<h:commandButton class="button"
						value="#{msg.BU_editProfile_editP_button}"
						action="#{editProfileBean.updateUser}"
						onclick="#{msg.TG_ticketDetail_confMessage}" />
				</div>

			</h:form>



			<h:form>

				<h3>
					<h:outputText value="#{msg.BU_editProfile_updatePass_header}" />
				</h3>
				<br />
				<h:outputText rendered="#{editProfileBean.confPassmsg != ''}"
					value="#{editProfileBean.confPassmsg}" />
				<h:panelGrid class="panelGrid" border="0" columns="2">
					<h:outputText value="#{msg.BU_editProfile_updatePass_oldPass}"></h:outputText>
					<h:inputSecret value="#{editProfileBean.userDTO.password}"
						required="true"
						requiredMessage="#{msg.BU_editProfile_requiredMessage3}"></h:inputSecret>
					<h:outputText value="#{msg.BU_editProfile_updatePass_newPass}"></h:outputText>
					<h:inputSecret id="newPass" value="#{editProfileBean.pass}"
						required="true"
						requiredMessage="#{msg.BU_editProfile_requiredMessage4}">
						<f:validator validatorId="validators.PasswordValidator" />
					</h:inputSecret>
					<h:outputText value="#{msg.BU_editProfile_updatePass_confPass}"></h:outputText>
					<h:inputSecret id="confPass" value="#{editProfileBean.confPass}"
						required="true"
						requiredMessage="#{msg.BU_editProfile_requiredMessage5}">
						<f:validator validatorId="validators.PasswordValidator" />
					</h:inputSecret>
				</h:panelGrid>
				<br />

				<div class="middle">
					<h:commandButton value="#{msg.BU_editProfile_updatePass_button}"
						class="button" action="#{editProfileBean.updatePassword}"
						onclick="#{msg.TG_ticketDetail_confMessage}" />
				</div>

			</h:form>

			<h:form rendered="#{inactiveManager.isom}">
				<div class="middle">
					<h3>
						<h:outputText value="#{msg.BU_editProfile_setStatus_header}"></h:outputText>
					</h3>
					
					<h:outputText id="confmsg" value="#{inactiveManager.confStatusmsg}"></h:outputText>

					<br />
					
					<h:selectOneRadio class="middle" id="stat"
						value="#{inactiveManager.selected}">
						<f:selectItem itemLabel="#{msg.BU_editProfile_setStatus_activ}"
							itemValue="activ" />
						<f:selectItem itemLabel="#{msg.BU_editProfile_setStatus_inactiv}"
							itemValue="inactiv" />
					</h:selectOneRadio>

					<br />

					 <h:commandButton class="button"
						value="#{msg.BU_editProfile_setStatus_button}"
						actionListener="#{inactiveManager.redirectAdmin}"> 
						
						<f:ajax execute="stat" render="confmsg"></f:ajax>
						
					</h:commandButton>
				</div>
				<br />
			</h:form>
		</div>
	</ui:define>

</ui:composition>

</html>